Exploring TM1 - a Chartertech Company
Search
Close this search box.

How to Delete All Elements from a TM1 Dimension: DimensionDeleteAllElements

Have you ever needed to just delete all elements from a dimension in TM1? Well there is a super easy function that does just this. Using DimensionDeleteAllElements, then one click and zap, they’re gone.

Syntax of DimensionDeleteAllElements

The syntax is:

DimensionDeleteAllElements(DimName);

where DimName is the name of the dimension you want to delete all elements from.

Example of DimensionDeleteAllElements

Prolog Tab

DimName = Customer;
DimensionDeleteAllElements(DimName);

This will delete all elements from the Customer Dimension.

Warning about DimensionDeleteAllElements!

DimensionDeleteAllElements obviously deletes all elements from a dimension. Thanks Sherlock. Remember, though, that if you have data on any element in any cube where this dimension is used, that data will also be deleted.

However it Might Not Delete All Data…

Yes, there’s a catch to that statement immediately above. If you re-add those elements on the Metadata tab of the same TI, then the data will not be lost for the recreated elements.

Therefore, if you, say had the following in a TI:

Prolog Tab

DimName = Customer;
DimensionDeleteAllElements(DimName);

Metadata Tab

DimensionElementComponentAdd ( DimName, vCustomer);

Then the code in the Prolog will delete all elements from the Customer dimension. The code then in the Metadata tab will add all data from the vCustomer variable back into the Customer dimension.

So, assuming that customer ABC123 was originally in the Customer dimension and they had sales in a Sales cube, and ABC123 was in the source data, they would be reinstated by the DimensionElementComponentAdd and all existing data kept regardless of the delete.

If it Doesn’t Work…

If you use this function and find that it does not delete all elements as promised on the ticket, try putting it in its own TI and then run that independently of the dim build TI.

Summary

DimensionDeleteAllElements is a really powerful TI function. Just use it carefully. Maybe make sure you have a backup before you use it for the first time!

  • This field is for validation purposes and should be left unchanged.

Post Sections

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Log In